﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Electronic_work_order.Model;
using Electronic_work_order.Interfacess.OA_Process_application_Zhou;
namespace Electronic_work_order.Controllers
{
    
    [ApiController]
    public class OA_Process_zhouController : ControllerBase
    {
        private readonly Interface_Process_application _process;

        public OA_Process_zhouController(Interface_Process_application process)
        {
            _process = process;
        }
        [HttpGet]
        [Route("/[controller]/GetOrganizations")]
        //查询部门 
        public IEnumerable<Organization> GetOrganizations()
        {
            return _process.GetOrganizations();
        }
        [HttpGet]
        [Route("/[controller]/getManage")]
        //查经理
        public IEnumerable<Position> getManage(int OrganizationID)
        {
            return _process.getManage(OrganizationID);
        }
        [HttpGet]
        [Route("/[controller]/getDirector")]
        //查主管
        public IEnumerable<Position> getDirector(int grade)
        {
            return _process.getDirector(grade);
        }
        [HttpPost]
        [Route("/[controller]/Add_LeaveForm")]
        //人员请假表（添加请假登记表）
        public int Add_LeaveForm(LeaveForm leave)
        {
            return _process.Add_LeaveForm(leave);
            
        }
     
        [HttpPut]
        [Route("/[controller]/Update_LeaveForm")]
        //修改人员请假（修改请假登记表）
        public int Update_LeaveForm(LeaveForm leave)
        {
           return _process.Update_LeaveForm(leave);
        }

        [HttpGet]
        [Route("/[controller]/GetLeaves")]
        //查询所有请假人
        public IEnumerable<LeaveForm> GetLeaves()
        {
            return _process.GetLeaves();
        }
        [HttpGet]
        [Route("/[controller]/GetLeave_Types")]
        //查询请假类型表
        public IEnumerable<Leave_Type> GetLeave_Types()
        {
            return _process.GetLeave_Types();
        }
        [HttpGet]
        [Route("/[controller]/getStates")]
        //查询申请状态表
        public IEnumerable<Process_application_State> getStates()
        {
            return _process.getStates();
        }
        [HttpGet]
        [Route("/[controller]/Leaves_XQ")]
        //根据登陆成功后查询自己请假的信息
        public object Leaves_XQ(int ID)
        {
            return _process.Leaves_XQ(ID);
        }
        [HttpPost]
        [Route("/[controller]/Add_Purchase_Goods")]
        //添加采购物品（申请采购）
        public int Add_Purchase_Goods(Purchase_goods goods) {
            return _process.Add_Purchase_Goods(goods);
        }

        [HttpGet]
        [Route("/[controller]/GetUserName")]
        public Users GetUserName(string UsersName)
        {
            return _process.GetUserName(UsersName);
        }
    }
}
